// ---------------------------------------------------------------------
//
// -- 浮动分数
// -- author £
//
// ---------------------------------------------------------------------

const Y_UP = 100,
    SHOW_TIME = 0.7;

cc.Class({
    extends: cc.Component,

    properties: {
        num: require('BaseNum')
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    ctor: function () {
        this.pool = null;
    },

    start () {
        // this.show(100);
    },

    show: function (score) {
        this.num.updateNum('+' + score + '$');
        this.num.node.stopAllActions();
        this.num.node.opacity = 255;
        // this.node.x = 0;
        // this.node.y = 0;
        this.num.node.y = 0;
        this.num.node.runAction(
            cc.sequence(
                cc.spawn(
                    cc.fadeTo(SHOW_TIME, 0),
                    cc.moveTo(SHOW_TIME, 0, Y_UP)
                ),
                cc.callFunc(this.showEnd, this)
            )
        );
    },

    showEnd: function (target) {
        // this.num.node.stopAllActions();
        this.node.parent = null;

        // if (this.pool) {
        //     this.pool.put(this.node);
        // }
    }

    // update (dt) {},
});
